<template>
  <div>
    <el-card class="box-card">
      <div style="display: flex;align-items: center;padding-top: 20px;">
        <el-form ref="form" :model="form" label-width="100px" style="display: flex;">
          <el-form-item label="合作商搜索" style="width: 400px;height: 50px;">
            <el-input v-model="form.name" placeholder="请输入" />
          </el-form-item>
          <el-button type="primary" icon="el-icon-search" style="width: 100px;height: 40px;margin-left: 30px;">查询
          </el-button>
        </el-form>
      </div>

    </el-card>
    <el-card class="box-card2">
      <div>
        <el-button type="primary" icon="el-icon-circle-plus" style="background-color: #ff6a28;border: none;" @click="partnerAdd">新建</el-button>
      </div>

      <el-table
        :data="tableData"
        style="width: 100%"
      >
        <el-table-column
          prop="date"
          label="序号"
        >
          <template v-slot="{$index}">
            {{ $index }}
          </template>

        </el-table-column>
        <el-table-column
          prop="name"
          label="合作商名称"
        />
        <el-table-column
          prop="name"
          label="账号"
        />
        <el-table-column
          prop="name"
          label="设备数量"
        />
        <el-table-column
          prop="name"
          label="分成比例"
        />
        <el-table-column
          prop="name"
          label="联系人"
        />
        <el-table-column
          prop="name"
          label="联系电话"
        />

        <el-table-column
          label="操作"
        >
          <template slot-scope="scope">
            <el-button type="text" size="small" @click="resetPasswords">重置密码</el-button>
            <el-button type="text" size="small" @click="handleClick(scope.row)">查看详情</el-button>
            <el-button type="text" size="small" @click="handleClick(scope.row)">修改</el-button>
            <el-button type="text">删除</el-button>
          </template>
        </el-table-column>
      </el-table>
      <el-pagination
        :current-page="currentPage4"
        :page-sizes="[100, 200, 300, 400]"
        :page-size="100"
        layout="slot"
        :highlight-current-row="true"
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
      >
        <div class="pagination">
          <span style="color:#dbe5ef">共{{ total }}条数据 第1/13页</span>
          <div>
            <el-button disabled style="background-color: #edf0f9;color: #d8dde3;">上一页</el-button>
            <el-button style="background-color: #d5ddf8; color: #606266;">下一页</el-button>
          </div>
        </div>
      </el-pagination>
    </el-card>
    <PartnerAdd :dialog-table-visible.sync="dialogTableVisible" />
  </div>

</template>
<script>
import PartnerAdd from './components/PartnerAdd.vue'
export default {
  name: '',
  components: {
    PartnerAdd
  },
  data() {
    return {
      form: {},
      dialogTableVisible: false,
      tableData: [{
        date: '2016-05-02',
        name: '王小虎',
        province: '上海',
        city: '普陀区',
        address: '上海市普陀区金沙江路 1518 弄',
        zip: 200333
      }, {
        date: '2016-05-04',
        name: '王小虎',
        province: '上海',
        city: '普陀区',
        address: '上海市普陀区金沙江路 1517 弄',
        zip: 200333
      }, {
        date: '2016-05-01',
        name: '王小虎',
        province: '上海',
        city: '普陀区',
        address: '上海市普陀区金沙江路 1519 弄',
        zip: 200333
      }, {
        date: '2016-05-03',
        name: '王小虎',
        province: '上海',
        city: '普陀区',
        address: '上海市普陀区金沙江路 1516 弄',
        zip: 200333
      }],
      currentPage4: 4,
      total: 200
    }
  },
  computed: {
  },
  created() {
  },
  methods: {
    handleClick(row) {
      console.log(row)
    },
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`)
    },
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`)
    },
    resetPasswords() {
      this.$confirm('', '确定要重置服务商密码吗', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        center: true,
        type: 'warning'
      }).then(() => {
        this.$message({
          type: 'success',
          message: '重置成功!'
        })
      })
    },
    partnerAdd() {
      this.dialogTableVisible = true
    }
  }
}
</script>
<style lang='scss'  scoped>

.box-card{
  margin-bottom: 20px;
}

// 分页插槽样式
.pagination{
  display: flex;
  justify-content: space-between;
}
 ::v-deep.el-table td, .el-table th.is-leaf {
    border-bottom: none;
}
</style>
